package com.qf.android.huihui.adapter.shopping;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.qf.android.huihui.R;
import com.qf.android.huihui.bean.show.shoppingbottom.ShoppingBottomBean;

import java.util.List;

/**
 * Created by 韩爽 on 2017/1/12.
 */

public class ShoppingHotSearchAdapter extends RecyclerView.Adapter<ShoppingHotSearchAdapter.MyHolder> {
    private List<ShoppingBottomBean.DataBean.ListBeanXX.HotSearchBean.ListBean> list;
    private Context context;

    public ShoppingHotSearchAdapter(List<ShoppingBottomBean.DataBean.ListBeanXX.HotSearchBean.ListBean> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public ShoppingHotSearchAdapter.MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(context).inflate(R.layout.fragment_shopping_hotsearch_item,parent,false);
        MyHolder myHolder=new MyHolder(view);
        return myHolder;
    }

    @Override
    public void onBindViewHolder(ShoppingHotSearchAdapter.MyHolder holder, int position) {
        ShoppingBottomBean.DataBean.ListBeanXX.HotSearchBean.ListBean bean = list.get(position);
        holder.textView.setText(bean.getWord());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class MyHolder extends RecyclerView.ViewHolder {
        private TextView textView;
        public MyHolder(View itemView) {
            super(itemView);
            textView= (TextView) itemView.findViewById(R.id.hotsearch_item_title);
        }
    }
}
